package com.lqq.chapter01;

/**
 * @Author lqq677
 * @Date 2021/8/9 16:41
 * @Description 守护线程
 */
public class Daemon {
    public static void main(String[] args) {
        Thread t = new Thread(() -> {
                System.out.println(Thread.currentThread().getName() + " isDaemon: " + Thread.currentThread().isDaemon());
                while (true) {
                }
        }, "t");
        //将t设置为守护线程
        t.setDaemon(true);
        t.start();
        System.out.println(Thread.currentThread().getName() + " over");

    }
}
